import 'dart:convert';

import 'package:flutter/services.dart';

import '../models/activity/activity_item.dart';
import '../models/activity/activity_session.dart';

class ActivityDetailsDao {
  static Future<List<ActivitySession>> fetchActivitySession(
      int activityId) async {
    final response = await rootBundle.loadString('assets/activitysession.json');
    final activitySession = ((jsonDecode(response)['activitySessions']) as List)
        .map((e) => ActivitySession.fromJson(e as Map<String, dynamic>))
        .toList();
    return activitySession;
  }

  static Future<List<ActivityItem>> fetchActivityItems() async {
    final response = await rootBundle.loadString('assets/activityItems.json');
    final activityItems = (jsonDecode(response) as List)
        .map((e) => ActivityItem.fromJson(e as Map<String, dynamic>))
        .toList();
    return activityItems;
  }
}
